package com.icinfo.cloud.provider.punish.api.controller;

import com.icinfo.cloud.provider.punish.api.dto.AbortRestoreCaseDto;
import com.icinfo.cloud.provider.punish.api.dto.CaseAbortRestoreRequest;
import com.icinfo.cloud.provider.punish.api.service.CaseEvidenceShareInventoryApiService;
import com.icinfo.cloud.provider.punish.api.vo.AbortRestoreCaseVo;
import com.icinfo.cloud.provider.punish.api.vo.ShareEvidenceCaseVo;
import com.icinfo.cloud.provider.punish.api.vo.ShareEvidenceStageVo;
import com.icinfo.framework.core.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotBlank;
import java.util.Map;

/**
 * 证据共享库回调 提供外部API
 * @author Administrator
 */
@RestController
@RequestMapping("/evidenceShare")
public class CaseEvidenceShareInventoryApiController extends BaseController {

    @Autowired
    private CaseEvidenceShareInventoryApiService caseEvidenceShareInventoryApiService;

    /**
     * 3、获取案件信息信息接口
     */
    @RequestMapping("/unifiedcase/jgcase/findCase")
    public ShareEvidenceCaseVo getCaseInfo(@RequestParam(value = "id") String id, String reCollectionName){
            return caseEvidenceShareInventoryApiService.getCaseInfo(id,reCollectionName);
    }


    /**
     *   四、获取案件阶段环节信息接口
     */
    @RequestMapping("/wf/process/traceCaseLinkInst")
    public ShareEvidenceStageVo getCaseStage(@NotBlank(message = "collectionId必传") String collectionId, String reCollectionName){
        return caseEvidenceShareInventoryApiService.getCaseStage(collectionId,reCollectionName);
    }

    /**
     *   中止或恢复办案计时
     */
    @PostMapping(value = "/wf/process/abortRestoreCase")
    public AbortRestoreCaseVo getCaseStage(@Validated @RequestBody AbortRestoreCaseDto dto){
        return caseEvidenceShareInventoryApiService.abortRestoreCase(dto);
    }
    /**
     * 鉴定期间中止或恢复办案计时
     * @author liyafeng
     * @date 2022/4/26
      * @param request
     * @return {@link AbortRestoreCaseVo}
     */
    @PostMapping(value = "/case/appraisal/caseAbortRestoreByAppraisal")
    public Map<String,Object> caseAbortRestoreByAppraisal(@Validated @RequestBody CaseAbortRestoreRequest request){
        return caseEvidenceShareInventoryApiService.caseAbortRestoreByAppraisal(request);
    }

}
